package io.github.controller.admin;

import io.github.entity.SysAreaEntity;
import io.github.service.SysAreaServive;
import io.github.util.R;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author: weil
 * @date: 2019/9/23 11:35
 * @version: 1.0
 * @description:
 */
@Controller
@RequestMapping("/admin/sys")
public class SysAreaController extends AbstractController {
    @Resource
    private SysAreaServive sysAreaServive;

    /**
     * 所有地区名称及ID
     */
    @RequestMapping(value = "/getArea", method = RequestMethod.POST)
    @ResponseBody
    public R getArea() {
        logger.info("查询所有地区接口");

        List<SysAreaEntity> adminList = sysAreaServive.queryAllArea();
        //List<SysAreaEntity> areaEntity = adminList.getRecords();
//        PageUtils pageUtil = new PageUtils(adminList.getRecords(), adminList.getTotal(), adminList.getSize(),
//                adminList.getCurrent());

        return R.ok().put("list", adminList);
    }

}
